package org.training.apr.service.impl;

import java.util.List;

import org.training.apr.dao.EnterpriseDao;
import org.training.apr.model.Enterprise;
import org.training.apr.service.EnterpriseService;

public class EnterpriseServiceImpl implements EnterpriseService {
	private EnterpriseDao dao;
	
	public EnterpriseServiceImpl(EnterpriseDao dao) {
		this.dao = dao;
	}

	public Enterprise read(Long id) {
		return dao.read(id);
	}

	public Enterprise findByName(String name) {
		List<Enterprise> result = dao.findByName(name);
		
		if(result.size() == 0) {
			return null;
		}
		return result.get(0);
	}

}
